package com.qst.setting.controller;

import com.qst.domain.entity.Mess;
import com.qst.domain.entity.User;
import com.qst.setting.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletRequest;

@RestController
@RequestMapping("/setting")
public class SettingController {

    @Autowired
    UserService userService;

    @PostMapping("/setMessage")
    public Mess setAbout(@RequestBody User user, @RequestHeader("id")Integer id){
        return userService.setMessage(user,id);
    }

    @PostMapping("/setPassword")
    public Mess setPassword(String oldPassword,String newPassword,@RequestHeader("id")Integer id){
        return userService.setPassword(oldPassword,newPassword,id);
    }

    @PostMapping("/setIcon")
    public Mess setIcon(@RequestHeader("id")Integer id,String iconUrl){
        return userService.setIcon(iconUrl,id);
    }
}
